package com.example.hello.client.NavHeader;

import com.example.hello.BootstrapNavHeader;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.shared.ui.Connect;

@Connect(BootstrapNavHeader.class)
public class BootstrapNavHeaderConnector extends AbstractComponentConnector {

    @Override
    protected Widget createWidget() {
        return GWT.create(VBootstrapNavHeader.class);
    }

    @Override
    public BootstrapNavHeaderState getState() {
        return (BootstrapNavHeaderState) super.getState();
    }

    @Override
    public VBootstrapNavHeader getWidget() {
        return (VBootstrapNavHeader) super.getWidget();
    }

    @Override
    public void onStateChanged(StateChangeEvent stateChangeEvent) {
        super.onStateChanged(stateChangeEvent);

        BootstrapNavHeaderState state = getState();

        VBootstrapNavHeader NavHeader = getWidget();

        NavHeader.setText(state.getText());
    }

}